from st_spider import *
import time


class SpiderDemo(object):
    def __init__(self):
        pass

    def get_time2(func):
        """
        :param func:被装饰的函数带参数
        :return:
        """
        def wrapper(*args, **kwargs):
            startTime = time.time()
            
            func(*args, **kwargs)
            endTime = time.time()
            processTime = (endTime - startTime) * 1000
            print("This function timing is %f ms" % processTime)
        return wrapper

    @get_time2
    def test(self):
        time.sleep(0.8)
        print("test is over")


if __name__ == '__main__':
    sd = SpiderDemo()
    sd.test()
